 module.exports = function printScore(studentArr,studentidArr){
    let str = '';
    for(let itemid of studentidArr){
        for(let itemobj of studentArr){
            if(itemid === itemobj.id){
                let sum = parseInt(itemobj.score.Math) + parseInt(itemobj.score.Chi) +
                        parseInt(itemobj.score.Eng) + parseInt(itemobj.score.Code);
                let average = (sum / 4).toFixed(1)
                str += `${itemobj.name}|${itemobj.score.Math}|${itemobj.score.Chi}|${itemobj.score.Eng}|${itemobj.score.Code}|${average}|${sum}\n`;
            }
        }
    }
    console.log(`姓名|数学|语文|英语|编程|平均分|总分\n`+
    `========================\n`+
    `${str}`+
    `========================\n`+
    `全班总分平均数：xxx\n`+
    `全班总分中位数：xxx\n`);

    return "避免凋零，我想我也会避免栽种！";
}
// let student = [{name:"zhangh",
// id:'1234',
// etchin:"h",
// klass:"21",
// score:{Math:"100",Eng:"90",Chi:"95",Code:"95"}},
// {name:"zhuzi",
// id:'4321',
// etchin:"h",
// klass:"21",
// score:{Math:"100",Eng:"90",Chi:"95",Code:"95"}}];
// let studentid = ['1234','4321']; 
// printScore(student,studentid);